﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp
{
    public abstract class BaseObject
    {
        public Guid ID { get; }
        private double _hp { get; set; }
        public double HP { get { return _hp; } }

        protected abstract double _maxHP { get; set; }
        public double MaxHP { get { return _maxHP; } }
        public bool IsAlive { get { return this._hp > 0; } }

        protected abstract string _typeName { get; }
        public string TypeName { get { return _typeName; } }

        public BaseObject()
        {
            this.ID = Guid.NewGuid();
            this._hp = this._maxHP;
        }
        public BaseObject Attacked(AttackResult attack)
        {
            this._hp -= attack.AttackValue;
            if (this._hp < 0)
                this._hp = 0;
            return this;
        }

    }
}
